package com.yeswater.multithread.chapter1.test1_11.test4;

/**
 * author : yeswater
 * date : 2023/10/18
 */

public class MyThread extends Thread{
    @Override
    public void run() {
        // super.run();
        try {
            for (int i = 0; i < 500000; i++) {
                if (interrupted()) {
                    System.out.println(" 已经停止 即将退出 ");
                    // break;
                    throw new InterruptedException();
                }
                System.out.println("i=" + (i + 1));
            }
            System.out.println(" 我在 for 下面 ");
        } catch (InterruptedException e) {
            System.out.println(" 进 MyThread.java 类 run 方法中的 catch 了 ");
            e.printStackTrace();
        }
    }
}
